import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MyFrame1 extends JFrame {
    JTextField t1;
    JTextField t2;
    JButton b1;

    public MyFrame1(String name) {
        super(name);
        this.setSize(600, 600);
        this.t1 = new JTextField(20);
        this.t2 = new JTextField(20);
        this.b1 = new JButton("复制");
        this.add(this.t1);
        this.add(this.t2);
        this.add(this.b1);
        this.setLayout(new FlowLayout());
        this.setVisible(true);
        this.setDefaultCloseOperation(3);
        MyFrame1.H d = new MyFrame1.H();
        this.b1.addActionListener(d);
        this.t1.addActionListener(d);
    }

    public static void main(String[] args) {
        new MyFrame("第一个窗口测试");
    }

    class H implements ActionListener {
        H() {
        }

        public void actionPerformed(ActionEvent e) {
            String s = MyFrame1.this.t1.getText();
            MyFrame1.this.t2.setText(s);
            MyFrame1.this.t1.setText(" ");
        }
    }
}

